package com.redrose.flutterdemo.utils;

import android.content.Context;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.redrose.flutterdemo.R;


public class GlideUtils {
    private static Context mContext;

    public static void init(Context context){
        mContext = context;
    }
    public static void load(ImageView imageView, String filePath){
        Glide.with(mContext).load(filePath).placeholder(R.mipmap.ic_launcher).error(R.mipmap.ic_launcher).into(imageView);
    }
    public static void loadByte(ImageView imageView, byte[] bytes){
        Glide.with(mContext).load(bytes).placeholder(R.mipmap.ic_launcher).error(R.mipmap.ic_launcher).bitmapTransform(new GlideCircleTransform(mContext)).into(imageView);
//        ByteArrayOutputStream baos = new ByteArrayOutputStream();
//        Bitmap bitmap = BitmapUtils.bytesBitmap(bytes);
//        bitmap.compress(Bitmap.CompressFormat.PNG, 100, baos);
//        byte[] bitmapBytes = baos.toByteArray();
//        Glide.with(mContext)
//                .load(bitmapBytes)
//                .placeholder(R.mipmap.women2)
//                .dontAnimate()
//                .into(imageView);


    }
}
